package tgc.edu.tms.entity;

import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.Transient;

import tgc.edu.tms.custom.BaseEntity;

@Entity // 流水表/授课记录表
public class FlowTable extends BaseEntity<Integer> {
	private String classes; // 班级
	private String course; // 课程
	private String classRoom; // 教室
	private String teacher; // 教师
	private Integer zxs; // 总学时
	private String sknr; // 上课内容
	private String time; // 时间(日期)
	private String week; // 星期
	private String jc; // 节次
	private Integer ydrs; // 应到人数
	private Integer sdrs; // 实到人数
	private Integer qqrs; // 缺勤人数
	private String remarks; // 备注
	private String ld; // 楼栋
	private String lc; // 楼层
	private String kclbs; // 课程类型
	private String year; // 年级
	private String term; // 学期
	private Boolean xmh;

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getTerm() {
		return term;
	}

	public void setTerm(String term) {
		this.term = term;
	}

	public String getLd() {
		return ld;
	}

	public void setLd(String ld) {
		this.ld = ld;
	}

	public String getLc() {
		return lc;
	}

	public void setLc(String lc) {
		this.lc = lc;
	}

	public String getClasses() {
		return classes;
	}

	public void setClasses(String classes) {
		this.classes = classes;
	}

	public String getCourse() {
		return course;
	}

	public void setCourse(String course) {
		this.course = course;
	}

	public String getClassRoom() {
		return classRoom;
	}

	public void setClassRoom(String classRoom) {
		this.classRoom = classRoom;
	}

	public String getTeacher() {
		return teacher;
	}

	public void setTeacher(String teacher) {
		this.teacher = teacher;
	}

	public Integer getZxs() {
		return zxs;
	}

	public void setZxs(Integer zxs) {
		this.zxs = zxs;
	}

	public String getSknr() {
		return sknr;
	}

	public void setSknr(String sknr) {
		this.sknr = sknr;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public String getWeek() {
		return week;
	}

	public void setWeek(String week) {
		this.week = week;
	}

	public String getJc() {
		return jc;
	}

	public void setJc(String jc) {
		this.jc = jc;
	}

	public Integer getYdrs() {
		return ydrs;
	}

	public void setYdrs(Integer ydrs) {
		this.ydrs = ydrs;
	}

	public Integer getSdrs() {
		return sdrs;
	}

	public void setSdrs(Integer sdrs) {
		this.sdrs = sdrs;
	}

	public Integer getQqrs() {
		if(sdrs!=null) {
			qqrs = ydrs-sdrs;
		}
		return qqrs;
	}

	public void setQqrs(Integer qqrs) {
		this.qqrs = qqrs;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getKclbs() {
		return kclbs;
	}

	public void setKclbs(String kclbs) {
		this.kclbs = kclbs;
	}

	public Boolean getXmh() {
		return xmh==null?false:xmh;
	}

	public void setXmh(Boolean xmh) {
		this.xmh = xmh;
	}

	/***
	 * 取折和系数
	 * 
	 * @return
	 */
	@Transient
	public double getZhxs() {
		double b;
		if (classes.contains(",") || classes.contains("，")) {
			BigDecimal bd = new BigDecimal(ydrs);
			bd = bd.setScale(-1, BigDecimal.ROUND_DOWN);
			double a = Double.valueOf(bd.intValue());
			b = (a - 50) / 100 + 1;
			if (b > 1.8) {
				b = 1.8;
			}
		} else {
			b = 1;
		}
		return b;
	}
	
	

}
